package jdos.hardware;

import jdos.Dosbox;
import jdos.misc.Log;
import jdos.types.LogSeverities;
import jdos.types.LogTypes;

public class VGA_crtc {
	static int index;
	static int scan_len = 40;
    public static IoHandler.IO_WriteHandler vga_write_p3d4 = new IoHandler.IO_WriteHandler() {
        public void call(/*Bitu*/int port, /*Bitu*/int val, /*Bitu*/int iolen) {
            index=(short)val;
        }
    };

    public static IoHandler.IO_WriteHandler vga_write_p3d5 = new IoHandler.IO_WriteHandler() {
        public void call(/*Bitu*/int port, /*Bitu*/int val, /*Bitu*/int iolen) {
        //	if (VGA.vga.crtc.index)>0x18) LOG_MSG("VGA CRCT write %X to reg %X",val,VGA.vga.crtc.index));
            switch(index) {
            
            case 0x13:	/* Offset register */
                scan_len&=0x300;
                scan_len|=val;
                break;

            default:
                break;
            }
        }
    };

    public static void Init() {
        IoHandler.IO_RegisterWriteHandler(0x3d4,VGA_crtc.vga_write_p3d4,IoHandler.IO_MB);
        IoHandler.IO_RegisterWriteHandler(0x3d5,VGA_crtc.vga_write_p3d5,IoHandler.IO_MB);

    }
}
